#ifndef __RBUF_H__
#define __RBUF_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
	int data_len;
	int buf_size;
	int front;
	int rear;
	char *buf;
} rbuf_t;

#define RBUF_HEAD_SIZE		(sizeof(rbuf_t))

int rbuf_init(char *buf, int size);

void rbuf_reset(char *buf);

int rbuf_get_size(char *buf);

int rbuf_get_capacity(char *buf);

int rbuf_push(char *buf, char *data, int len);

int rbuf_pop(char *buf, char *data, int len);

#ifdef __cplusplus
}
#endif

#endif
